<%--
  Created by IntelliJ IDEA.
  User: Tian
  Date: 2024/3/11
  Time: 14:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
  <script src="js/vue.js"></script>
  <script src="js/axios.js"></script>
</head>
<body>
<div id="app" >
    <button @click="submit">提交</button>
    {{emp}}
    <button @click="submitPost">提交</button>
    {{emp.ename}}
</div>
<script>
    let vm=new Vue({
        el:"#app",
        data:{
            emp:{}
        },
        methods:{
            submit(){
                console.log("提交按钮触发了")
                axios.get("getAxios?id=1").then(res=>{
                    this.emp=res.data
                })
            },
            submitPost(){
                axios.post("getPostAxios",{empno:1111,ename:"Run"}).then(res=>{
                    console.log(res.data)
                    this.emp=res.data
                    console.log(this.emp)
                })
            }
        }
    })
</script>
</body>
</html>
